<?php
namespace Home\Model;
use Think\Model;
class CateModel extends Model {

	protected $trueTableName = 'my_cate'; 
	private $field = 'id,name';

	/**
	 * 获取 pid 为 0的 分类
	 */
	public function first($ids)
	{
		$field = $this->field;
		
		if(is_array($pid)){
			$where['id'] = array('in', $ids);
		}else{
			$where['pid'] = $ids;
		}
		return $this->where($where)->field($field)->select();
	}

	// 获取名称
	public function get_name($ids)
	{
		$field = $this->field;

		$where['id'] = array('in', $ids);
		$info = $this->where($where)->getField('id,name');
		return array_values($info);
	}
}